/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.logueo.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import com.isn.atencionemergencia.entity.OrdenDeAtencionDeEmergencia;
import com.isn.atencionemergencia.entity.ResultadoDeOrdenDeAtencionDeEmergencia;
import com.isn.tratamiento.entity.AplicacionVacuna;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "personal_asistencial")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PersonalAsistencial.findAll", query = "SELECT p FROM PersonalAsistencial p"),
    @NamedQuery(name = "PersonalAsistencial.findByCodAsis", query = "SELECT p FROM PersonalAsistencial p WHERE p.codAsis = :codAsis"),
    @NamedQuery(name = "PersonalAsistencial.findByNomAsis", query = "SELECT p FROM PersonalAsistencial p WHERE p.nomAsis = :nomAsis"),
    @NamedQuery(name = "PersonalAsistencial.findByApePatAsis", query = "SELECT p FROM PersonalAsistencial p WHERE p.apePatAsis = :apePatAsis"),
    @NamedQuery(name = "PersonalAsistencial.findByApeMatAsis", query = "SELECT p FROM PersonalAsistencial p WHERE p.apeMatAsis = :apeMatAsis")})
public class PersonalAsistencial implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Asis", columnDefinition="CHAR(5) unsigned")
    private String codAsis;
    @Column(name = "Nom_Asis")
    private String nomAsis;
    @Column(name = "Ape_Pat_Asis")
    private String apePatAsis;
    @Column(name = "Ape_Mat_Asis")
    private String apeMatAsis;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codAsis")
    private Collection<OrdenDeAtencionDeEmergencia> ordenDeAtencionDeEmergenciaCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codAsis")
    private Collection<AplicacionVacuna> aplicacionVacunaCollection;
    @JoinColumn(name = "Cod_Usu", referencedColumnName = "Usuario")
    @ManyToOne(optional = false)
    private Usuario codUsu;
    @JoinColumn(name = "Cod_Tipo_Usu", referencedColumnName = "Cod_Tipo_Usu")
    @ManyToOne(optional = false)
    private TipoUsuario codTipoUsu;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codAsis")
    private Collection<ResultadoDeOrdenDeAtencionDeEmergencia> resultadoDeOrdenDeAtencionDeEmergenciaCollection;

    public PersonalAsistencial() {
    }

    public PersonalAsistencial(String codAsis) {
        this.codAsis = codAsis;
    }

    public String getCodAsis() {
        return codAsis;
    }

    public void setCodAsis(String codAsis) {
        this.codAsis = codAsis;
    }

    public String getNomAsis() {
        return nomAsis;
    }

    public void setNomAsis(String nomAsis) {
        this.nomAsis = nomAsis;
    }

    public String getApePatAsis() {
        return apePatAsis;
    }

    public void setApePatAsis(String apePatAsis) {
        this.apePatAsis = apePatAsis;
    }

    public String getApeMatAsis() {
        return apeMatAsis;
    }

    public void setApeMatAsis(String apeMatAsis) {
        this.apeMatAsis = apeMatAsis;
    }

    @XmlTransient
    public Collection<OrdenDeAtencionDeEmergencia> getOrdenDeAtencionDeEmergenciaCollection() {
        return ordenDeAtencionDeEmergenciaCollection;
    }

    public void setOrdenDeAtencionDeEmergenciaCollection(Collection<OrdenDeAtencionDeEmergencia> ordenDeAtencionDeEmergenciaCollection) {
        this.ordenDeAtencionDeEmergenciaCollection = ordenDeAtencionDeEmergenciaCollection;
    }

    @XmlTransient
    public Collection<AplicacionVacuna> getAplicacionVacunaCollection() {
        return aplicacionVacunaCollection;
    }

    public void setAplicacionVacunaCollection(Collection<AplicacionVacuna> aplicacionVacunaCollection) {
        this.aplicacionVacunaCollection = aplicacionVacunaCollection;
    }

    public Usuario getCodUsu() {
        return codUsu;
    }

    public void setCodUsu(Usuario codUsu) {
        this.codUsu = codUsu;
    }

    public TipoUsuario getCodTipoUsu() {
        return codTipoUsu;
    }

    public void setCodTipoUsu(TipoUsuario codTipoUsu) {
        this.codTipoUsu = codTipoUsu;
    }

    @XmlTransient
    public Collection<ResultadoDeOrdenDeAtencionDeEmergencia> getResultadoDeOrdenDeAtencionDeEmergenciaCollection() {
        return resultadoDeOrdenDeAtencionDeEmergenciaCollection;
    }

    public void setResultadoDeOrdenDeAtencionDeEmergenciaCollection(Collection<ResultadoDeOrdenDeAtencionDeEmergencia> resultadoDeOrdenDeAtencionDeEmergenciaCollection) {
        this.resultadoDeOrdenDeAtencionDeEmergenciaCollection = resultadoDeOrdenDeAtencionDeEmergenciaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codAsis != null ? codAsis.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PersonalAsistencial)) {
            return false;
        }
        PersonalAsistencial other = (PersonalAsistencial) object;
        if ((this.codAsis == null && other.codAsis != null) || (this.codAsis != null && !this.codAsis.equals(other.codAsis))) {
            return false;
        }
        return true;
    }
    
}
